<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('修改环境配置')"/>
    <style>
        /* 商务风格CSS变量 */
        :root {
            --primary-color: #2c5aa0;
            --secondary-color: #34495e;
            --accent-color: #3498db;
            --success-color: #27ae60;
            --warning-color: #f39c12;
            --danger-color: #e74c3c;
            --light-bg: #f8f9fa;
            --white: #ffffff;
            --border-color: #e1e8ed;
            --text-primary: #2c3e50;
            --text-secondary: #7f8c8d;
            --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
            --shadow-medium: 0 4px 12px rgba(0,0,0,0.15);
            --border-radius: 8px;
        }

        /* 页面背景 */
        .white-bg {
            background: var(--light-bg) !important;
        }

        /* 容器优化 */
        .wrapper {
            background: var(--white);
            border-radius: var(--border-radius);
            box-shadow: var(--shadow-medium);
            margin: 20px;
            border: 1px solid var(--border-color);
        }

        .ibox-content {
            padding: 30px;
        }

        /* 两列布局容器 */
        .config-container {
            display: flex;
            gap: 30px;
            margin-top: 20px;
        }

        .config-section {
            flex: 1;
            background: var(--white);
            border: 2px solid var(--border-color);
            border-radius: var(--border-radius);
            padding: 25px;
            box-shadow: var(--shadow-light);
        }

        .config-section h3 {
            color: var(--primary-color);
            font-weight: 600;
            margin: 0 0 20px 0;
            padding-bottom: 12px;
            border-bottom: 2px solid var(--accent-color);
            font-size: 16px;
            display: flex;
            align-items: center;
        }

        .config-section h3::before {
            content: "";
            width: 4px;
            height: 20px;
            background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
            margin-right: 10px;
            border-radius: 2px;
        }

        /* 表单组优化 - 垂直布局 */
        .form-group {
            margin-bottom: 20px;
            padding: 0;
        }

        .form-group label {
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 8px;
            display: block;
            font-size: 14px;
        }

        .form-group .form-control {
            width: 100%;
            height: 40px;
            border: 2px solid var(--border-color);
            border-radius: 6px;
            padding: 10px 15px;
            font-size: 14px;
            transition: all 0.3s ease;
            background: var(--white);
        }

        .form-group .form-control:focus {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
            outline: none;
            transform: translateY(-1px);
        }

        /* 选择框优化 */
        .form-group select.form-control {
            cursor: pointer;
        }

        /* 列布局重置 */
        .col-xs-12 {
            padding: 0;
        }

        /* 标题优化 */
        .wrapper h3 {
            color: var(--text-primary);
            font-weight: 600;
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid var(--border-color);
        }

        /* 响应式优化 */
        @media (max-width: 768px) {
            .config-container {
                flex-direction: column;
                gap: 20px;
            }

            .config-section {
                padding: 20px;
            }

            .config-section h3 {
                font-size: 14px;
            }

            .wrapper {
                margin: 10px;
            }

            .ibox-content {
                padding: 20px;
            }
        }

        @media (max-width: 1024px) {
            .config-container {
                gap: 20px;
            }

            .config-section {
                padding: 20px;
            }
        }

        /* 表单验证样式 */
        .form-control.error {
            border-color: var(--danger-color);
        }

        .form-control.valid {
            border-color: var(--success-color);
        }

        /* 输入框聚焦动画 */
        .form-control {
            position: relative;
        }

        .form-control:focus {
            transform: translateY(-1px);
        }
    </style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-config-edit" th:object="${coverageEnvConfig}">
        <input name="configId" th:field="*{configId}" type="hidden">
        <div class="config-container">
            <!-- 左列：应用配置 -->
            <div class="config-section">
                <h3>应用配置</h3>
                <div class="form-group">
                    <label>客户端名称：</label>
                    <input name="clientName" th:field="*{clientName}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>应用名称：</label>
                    <input name="appName" th:field="*{appName}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>IP地址：</label>
                    <input name="ip" th:field="*{ip}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>端口：</label>
                    <input name="port" th:field="*{port}" class="form-control" type="text">
                </div> 
                <div class="form-group">
                    <label>覆盖率类型：</label>
                    <select name="coverageType" class="form-control"
                            th:with="type=${@dict.getType('coverage_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"
                                th:field="*{coverageType}"></option>
                    </select>
                </div>
                <div class="form-group">
                    <label>源码相对路径：</label>
                    <input name="sourceFiles" th:field="*{sourceFiles}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>Class文件相对路径：</label>
                    <input name="classFiles" th:field="*{classFiles}" class="form-control" type="text">
                </div>
            </div>

            <!-- 右列：仓库配置 -->
            <div class="config-section">
                <h3>仓库配置</h3>
                <div class="form-group">
                    <label>仓库地址：</label>
                    <input name="repositoryUrl" th:field="*{repositoryUrl}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>用户名：</label>
                    <input name="name" th:field="*{name}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>密码：</label>
                    <input name="password" th:field="*{password}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>起始版本：</label>
                    <input name="versionStart" th:field="*{versionStart}" class="form-control" type="text">
                </div>
                <div class="form-group">
                    <label>当前版本：</label>
                    <input name="versionNow" th:field="*{versionNow}" class="form-control" type="text">
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var prefix = ctx + "server/config";
    $("#form-config-edit").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/edit", $('#form-config-edit').serialize());
        }
    }
</script>
</body>
</html>